<template>
    
    <!-- 组件模板内容 -->
    <div class="comp-wrap"><!-- 
        <div class="weui-cells">
            <a class="weui-cell weui-cell_access" href="javascript:;">
                <div class="weui-cell__bd">
                    <p>{{title}}</p>
                </div>
                <div class="weui-cell__ft ver-ali">{{date}}</div>
            </a>
        </div> -->
        <div class="weui-cells__title black relative">{{title}}<span v-if="required == 1" class="required_icon"> (必填)</span></div>
        <div class="weui-cells__tips">{{tip}}</div>
        <div class="weui-cells mr-top-0">
            <a class="weui-cell weui-cell_access padding_a" href="javascript:;" @click="selectDate">
                <div class="weui-cell__bd isValue">
                    <p v-if="date">{{date}}</p>
                    <p v-else class="isTip">请选择日期</p>
                </div>
                <div class="weui-cell__ft height">
                </div>
            </a>
        </div>
    </div>
</template>

<script>
    /**
     *  引入工具类库 或 Navtive API
     *  example : import widget from 'gapi/widget'
     */
    import KCApiApp from 'clientApi/KCApiApp.js'
    import * as util from 'js/util.js'

    /**
     *  引入Action
     *  example : import { someFunction } from './SomeAction'
     */
    
    /**
     *  引入Getter
     *  example : import { someFunction } from './SomeGetters'
     */

    export default {
        vuex: {
            getters: {
                
            },
            actions: {

            }
        },
        props: ["title", "tip", "date", 'isvalid', 'required'],
        methods: {
            selectDate (){
                let date = new Date()
                let timestr = date.getTime()
                let today = util.getLocalTime(timestr, 'yyyy-MM-dd')
                // alert(today)
                //调取选择日期组件
                KCApiApp.showDatePicker('1000-01-01', '3999-12-31', this.date || today, (data) => {
                    // alert(JSON.stringify(data.SelectedDate))
                    // this.setupFormInfo.remind_time.push(data.SelectedDate)
                    this.date = data.SelectedDate
                })
            }
            // ,
            // changeTimeFormat(date){
            //     return date.replace(/-/g, '/')
            // }
        },
        created (){
            
        }
    }

    
</script>

<!-- CSS 样式 -->
<!-- <style src="static/css/global.css"></style> -->
<style type="text/css">
    div.ver-ali{
        /*line-height: 28px;*/
    }
    html body{
        /*background-color: #fff;*/
    }
    div.weui-cells{
        margin-top:0px;
    }
    div.weui-cells__tips{
        margin-bottom: .3em;
    }
    div.height{
        height:0;
    }
    a.padding_a{
        padding: 14px 12px;
    }
</style>

